function[res] = func_calculate_variability(path_origdata, ListPath, outputDIR, templateDIR, data_type, symbol)

SIDs = textread([ListPath '/variability_list_' data_type '_' symbol '.txt'],'%s');

tmp_hemi_Data = load_surf_file(path_origdata, SIDs{1}, 'lh');
[row, col] = size(tmp_hemi_Data);
res_lh_corr = [];
res_rh_corr = [];
%%%%%%%%%%%%%%%%%%%%

res = [];
for s = 1:length(SIDs)
    fprintf(['[step]: ' num2str(s) ' start \n']);

    sid = SIDs{s};

    item_data = load(['./fc_mats/' symbol '/' sid '_fc.mat'])

    item_data_fc = item_data.fc;

    % 计算左脑区
    for v = 1:length(SIDs)
        if s ~= v
            tar_sid = SIDs{v};

            tar_item_data = load(['./fc_mats/' symbol '/' tar_sid '_fc.mat']);

            tar_item_data_fc = tar_item_data.fc;

            C_res = func_matcorr(item_data_fc', tar_item_data_fc' );
            C_res(isnan(C_res)) = 0.0;

            res = [res; C_res];

            fprintf(['--> substep: ' num2str(v) '\n']);
        end
    end

    fprintf(['[step]: ' num2str(s) ' finished \n']);
end

res(isnan(res)) = 0.0;
res = mean(res, 1);
res = 1 - res;
fprintf('done');


lh = res(:, 1:2562)'
rh = res(:, 2563:5124)'

exclude_lh_template = [templateDIR '/lh_network_1_asym_fs4.mgh']
exclude_rh_template = [templateDIR '/rh_network_1_asym_fs4.mgh']
[lh_vol, M, mr_parms, volsz] = load_mgh(exclude_lh_template);
[rh_vol, M, mr_parms, volsz] = load_mgh(exclude_rh_template);

tem_lh = lh;
tem_rh = rh;

tem_lh(find(lh_vol == 1)) = 0.0;
tem_rh(find(rh_vol == 1)) = 0.0;

save_mgh(tem_lh, [outputDIR '/Variability/' 'lh_' data_type '_' symbol '_fs4_intra_variability.mgh'], eye(4));
save_mgh(tem_rh, [outputDIR '/Variability/' 'rh_' data_type '_' symbol '_fs4_intra_variability.mgh'], eye(4));
save([outputDIR '/Variability/intra_Variability_FS4_' data_type '_' symbol '.mat'], 'lh', 'rh')
